<?php

class Application_Model_DbTable_User extends Zend_Db_Table_Abstract {

    protected $_name = 'user';
    protected $_dependentTables = array('Application_Model_DbTable_Zzzusezaj','Application_Model_DbTable_Karta');

    public function addUser($login, $password, $imie, $nazwisko, $email, $typ='klient') {
        $data = array(
            'USE_login' => $login,
            'USE_password' => $password,
            'USE_imie' => $imie,
            'USE_nazwisko' => $nazwisko,
            'USE_email' => $email,
            'USE_typ' => $typ
        );
        $this->insert($data);
    }

    public function getUser($login) {

        $rows = $this->fetchRow("USE_login = '$login'");
        return $rows->toArray();
    }

    public function updateUser($login, $password, $imie, $nazwisko, $email) {
        $data = array(
            'USE_imie' => $imie,
            'USE_nazwisko' => $nazwisko,
            'USE_password' => $password,
            'USE_email' => $email
        );
        $this->update($data, "USE_login = '$login'");
    }

}

?>
